package com.bruce.starts.demo.commonerror.collection;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @author luotuan
 * @Description
 * @create 2021-05-06 16:29
 **/
@Slf4j
public class ListDemo {
    private static List<List<Integer>> data = new ArrayList<>();
    private static void testData(){
        for(int i=0;i<1000;i++){
            List<Integer> rawList = IntStream.rangeClosed(1,100000).boxed().collect(Collectors.toList());
            data.add(rawList.subList(0,1));
        }
    }

    public static void main(String[] args) {
        int[] arr = {1,2,3};
        List list = Arrays.stream(arr).boxed().collect(Collectors.toList());
        list.add(4);
        Integer[] arr2 = {1,2,3};
        List list2 = Arrays.asList(arr2);
        arr2[1] = 12;
//        Arrays.stream(arr2).forEach(i->{
//            if(i==1){
//                arr[i] = 12;
//            }
//        });
        log.info("list:{} size: {} class: {}",list,list.size(),list.getClass());
        log.info("list:{} size: {} class: {}",list2,list2.size(),list2.getClass());
        testData();
    }
}
